#ifndef LEXERMODULE_H
#define LEXERMODULE_H

#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif

  class Accessor;
  class WordList;

  typedef void ( *LexerFunction )( unsigned int startPos, int lengthDoc, int initStyle,
                                   WordList *keywordlists[], Accessor &styler );
  typedef ILexer *( *LexerFactoryFunction )();


  class LexerModule {
    protected:
      int language;
      LexerFunction fnLexer;
      LexerFunction fnFolder;
      LexerFactoryFunction fnFactory;
      const char * const * wordListDescriptions;

    public:
      const char *languageName;
      LexerModule( int language_,
                   LexerFunction fnLexer_,
                   const char *languageName_ = 0,
                   LexerFunction fnFolder_ = 0,
                   const char * const wordListDescriptions_[] = NULL );
      LexerModule( int language_,
                   LexerFactoryFunction fnFactory_,
                   const char *languageName_,
                   const char * const wordListDescriptions_[] = NULL );
      virtual ~LexerModule() {
      }
      int GetLanguage() const { return language; }


      int GetNumWordLists() const;
      const char *GetWordListDescription( int index ) const;

      ILexer *Create() const;

      virtual void Lex( unsigned int startPos, int length, int initStyle,
                        WordList *keywordlists[], Accessor &styler ) const;
      virtual void Fold( unsigned int startPos, int length, int initStyle,
                         WordList *keywordlists[], Accessor &styler ) const;

      friend class Catalogue;
  };

  inline int Maximum( int a, int b ) {
    return ( a > b ) ? a : b;
  }


  #ifdef _MSC_VER
#pragma warning(disable: 4244 4309 4456 4457)
  #endif


  #if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wshadow"
  #endif

  #ifdef SCI_NAMESPACE
}
  #endif

#endif
